package org.distributed.transaction.core.event;

import org.distributed.transaction.core.context.TransactionContext;

/**
 * 分布式事务的生命周期
 *
 */
public interface Lifecycle {

	/**
	 * 开启分布式事务
	 * 
	 * @param transactionContext
	 */
	public void begin(TransactionContext transactionContext);

	/**
	 * 执行业务代码
	 * 
	 * @param transactionContext
	 * @return
	 */
	public Object execute(TransactionContext transactionContext);

	/**
	 * 提交事务
	 * 
	 * @param transactionContext
	 */
	public void commit(TransactionContext transactionContext);

	/**
	 * 回滚事务
	 * 
	 * @param transactionContext
	 */
	public void rollback(TransactionContext transactionContext);
}
